axios.interceptors.request.use((config) => {
  config.headers['X-Requested-With'] = 'xmlhttprequest'
  config.data = Qs.stringify(config.data)
  return config
})
axios.interceptors.response.use(
  (res) => {
    if (res.data.type == 'application/octet-stream') {
      var filename = res.headers['content-disposition']
      var blob = new Blob([res.data])
      var downloadElement = document.createElement('a')
      var href = window.URL.createObjectURL(blob)
      downloadElement.href = href
      downloadElement.download = filename.split('filename=')[1]
      document.body.appendChild(downloadElement)
      downloadElement.click()
      document.body.removeChild(downloadElement)
      window.URL.revokeObjectURL(href)
      return { status: 0, info: [] }
    }
    return res.data
  },
  function (err) {
    return Promise.reject(err)
  }
)
